#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX_N 1000
#define MAX_L 10001
int main()
{
    int n;
    char strings[MAX_N][MAX_L];
    int operations = 0;
    scanf("%d", &n);
    for (int i = 0;i < n;i++)
    {
        scanf("%s", strings[i]);
    }
    for (int i = 0;i < n - 1;i++)
    {
        for (int j = i + 1;j < n;j++)
        {
            if (strcmp(strings[i], strings[j]) > 0)
            {
                char temp[MAX_L];
                strcpy(temp, strings[i]);
                strcpy(strings[i], strings[j]);
                strcpy(strings[j], temp);
            }
        }
    }
    for (int i = 1;i < n;i++)
    {
        while (strcmp(strings[i], strings[i - 1]) == 0)
        {
            int len = strlen(strings[i]);
            strings[i][len] = 'A';
            strings[i][len + 1] = '\0';
            operations++;
        }
    }
    printf("%d\n", operations);
    return 0;
}